/*
 * MenuModelManager.h
 *
 *  Created on: Aug 13, 2013
 *      Author: epeterson
 */

#ifndef MENUMODELMANAGER_H_
#define MENUMODELMANAGER_H_

#include <QObject>
#include <QString>
#include <QVariant>
#include <QVariantMap>

#include <bb/cascades/DataModel>
#include <bb/cascades/GroupDataModel>

class MenuModelManager: public QObject
{
	Q_OBJECT;
	Q_PROPERTY(bb::cascades::DataModel * dataModel READ dataModel CONSTANT);
	Q_PROPERTY(QString menuId READ menuId WRITE setMenuId NOTIFY menuIdChanged);
	Q_PROPERTY(QString menuSource READ menuSource WRITE setMenuSource NOTIFY menuSourceChanged);

public:
	MenuModelManager(QObject * parent = 0);
	virtual ~MenuModelManager();

	bb::cascades::DataModel * dataModel(void);
	QString menuId(void);
	QString menuSource(void);

public slots:
	void setMenuId(QString menuId);
	void setMenuSource(QString menuSource);

signals:
	void menuIdChanged(void);
	void menuSourceChanged(void);

protected:
	bb::cascades::GroupDataModel _dataModel;
	QString _menuId;
	QString _menuSource;

	QVariantMap findMenu(const QVariant& data, QString menuId);

protected slots:
	void updateDataModel(void);
};

#endif /* MENUMODELMANAGER_H_ */
